<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQiiLanguageLanguageTable extends Migration
{
    /**
     * Schema table name to migrate
     * @var string
     */
    public $set_schema_table = 'qii_language_language';

    /**
     * Run the migrations.
     * @table qii_language_language
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable($this->set_schema_table)) return;
        Schema::create($this->set_schema_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('language_id')->comment('语言ID');
            $table->string('language_family', 50)->default('')->comment('家族名称');
            $table->string('language_name', 100)->default('')->comment('正式名称');
            $table->string('native_name', 200)->default('')->comment('本土名称');
            $table->string('iso_639_1', 3)->default('')->comment('639-1(html)');
            $table->string('iso_639_2_T', 4)->default('')->comment('639-2/T');
            $table->string('iso_639_2_B', 4)->default('')->comment('639-2/B');
            $table->string('iso_639_3', 10)->default('')->comment('639-3');
            $table->string('iso_639_6', 5)->default('')->comment('639-6');
            $table->text('notes')->nullable()->default(null)->comment('639-6');
            $table->unsignedTinyInteger('status')->default('2')->comment('1:启用|2:禁用');
            $table->unsignedInteger('modified_date')->default('0')->comment('修改时间');

            $table->unique(["iso_639_1"], 'iso_639_1');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
       Schema::dropIfExists($this->set_schema_table);
     }
}
